package view;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

/**
 * A PlainDocument that accept only strings in integer format
 *
 */
public class IntegerDocument extends PlainDocument {
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * 
	 */
	public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
        if(str!=null && str.matches("[\\d]*"))
            super.insertString(offs, str, a);
    }
}
